<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>methods</title>
    <script type="text/javascript" src="../assets/js/vue-2.3.0.js"></script>
</head>
<body>
    <h1>methods</h1>
    <hr>
    <div id="app">
        {{a}} 
        <button @click='add(2)'>点我</button>
    </div>
    <button onclick="app.add(3)">click me</button>
</body>
<script type="text/javascript">
    var app = new Vue({
        el:'#app',
        data:{
            message: 'helloworld!',
            a:1
        },
        methods:{
            add:function(num,$event){
                this.a+=num
                // console.log(event);
            }
        }
    })
</script>
</html>